package com.ruoyi.project.system.domain.vo;

import com.ruoyi.project.system.domain.SysProduct;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

@NoArgsConstructor
@Data
public class Promote {

    private Integer productId;

    private String productName;

    private String productIntroduce;

    private String scene;

    private Integer redPacketNum;

    /**
     * 系统底价
     */
    private BigDecimal sysFloorPrice;

    /**
     * 上级代理提成
     */
    private BigDecimal royalty;

    /**
     * 发邀用户计算得到的底价
     */
    private BigDecimal keepFloorPrice;

    /**
     * 发邀用户计算得到的底价
     */
    private BigDecimal floorPrice;

    /**
     * 用户佣金
     */
    private BigDecimal brokerage;

    /**
     * 最终价格
     */
    private BigDecimal pricing;

    private BigDecimal v0Pricing;

    public Promote(SysProduct sysProduct,
                   BigDecimal keepFloorPrice, BigDecimal sysFloorPrice,
                   BigDecimal royalty,
                   BigDecimal brokerage, BigDecimal pricing) {
        this.productId = sysProduct.getProductId();
        this.productName = sysProduct.getProductName();
        this.productIntroduce = sysProduct.getProductIntroduce();
        this.scene = sysProduct.getScene();
        this.v0Pricing = sysProduct.getV0Pricing();
        this.redPacketNum = sysProduct.getRedPacketNum();

        this.keepFloorPrice = keepFloorPrice;       // 系统基础低价 + 会存在的上级提成

        this.sysFloorPrice = sysFloorPrice;         // 系统收益 = 系统基础低价 + 价格分级系统抽润
        this.royalty = royalty;                     // 会存在的上级提成
        this.floorPrice = sysFloorPrice.add(royalty == null ? BigDecimal.valueOf(0) : royalty);
        this.brokerage = brokerage;                 // 佣金
        this.pricing = pricing;                     // 最终售价
    }
}
